package com.mes.warehouse.controller;

import com.mes.common.pojo.MESResult;
import com.mes.pojo.warehouse.WarehouseArea;
import com.mes.warehouse.server.WarehouseAreaServer;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 张喆
 * @Company
 * @Description
 * @Time 2024/10/25 9:32
 */
@RestController
@CrossOrigin
@RequestMapping("/warehouseArea")
public class WarehouseAreaController {
    @Autowired
    private WarehouseAreaServer warehouseAreaServer;
    @GetMapping("/list")
    public MESResult getList(WarehouseArea warehouseArea, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer limit){
        return warehouseAreaServer.queryAll(warehouseArea,pageNum,limit);
    }
    @GetMapping("/updateInfo")
    public MESResult getUpdateInfo(String warehouseAreaId,String warehouseId){
        return warehouseAreaServer.queryById(warehouseAreaId,warehouseId);
    }
    @DeleteMapping("/delete")
    public MESResult delete(String warehouseAreaId,String warehouseId){
        return warehouseAreaServer.deleteWarehouseArea(warehouseAreaId,warehouseId);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody WarehouseArea warehouseArea){
        return warehouseAreaServer.updateWarehouseArea(warehouseArea);
    }
    @PostMapping("/insert")
    public MESResult insert(@RequestBody WarehouseArea warehouseArea){
        return warehouseAreaServer.insertWarehouseArea(warehouseArea);
    }
}
